<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>搜索结果</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
    <div class="container">
        <div class="navbar">
            {% from 'macros.html' import search_form %}
            {{ search_form(request.args.get('q', '')) }}
        </div>

        <div class="content" id="search-results">
            {% if books is defined and books | length > 0 %}
                {% from 'macros.html' import book_card %}
                {% for book in books %}
                    {{ book_card(book) }}
                {% endfor %}
            {% elif request.args.get('q') is defined and request.args.get('q') %}
                <p>没有找到与 "{{ request.args.get('q') }}" 相关的书籍。</p>
            {% else %}
                <p>请输入搜索内容。</p>
            {% endif %}
        </div>
    </div>

</body>
</html>
